package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduSchoolXwtj.EduSchoolXwtjKeyVO;
import com.jwsoft.manager.common.vo.eduSchoolXwtj.EduSchoolXwtjQueryVO;
import com.jwsoft.manager.common.vo.eduSchoolXwtj.EduSchoolXwtjVO;
import com.jwsoft.manager.core.integration.EduSchoolXwtjIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 学位调剂网关
 *
 * @author zhiyuan
 * @since 2023-03-09
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "学位调剂", description = "学位调剂")
public class EduSchoolXwtjController {

    @Autowired
    public EduSchoolXwtjIntegration eduSchoolXwtjIntegration;

    @Operation(summary = "学位调剂分页查询",description = "学位调剂分页查询")
    @PostMapping(value = "/schoolXwtj0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSchoolXwtjVO>> getList(@RequestBody @Validated EduSchoolXwtjQueryVO vo) {
        return AppResponse.successData(eduSchoolXwtjIntegration.getList(vo));
    }

    @Operation(summary = "学位调剂根据主键查询详情",description = "学位调剂根据主键查询详情")
    @PostMapping(value = "/schoolXwtj0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolXwtjVO> getById(@RequestBody @Validated EduSchoolXwtjKeyVO vo) {
        return AppResponse.successData(eduSchoolXwtjIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学位调剂新增",description = "学位调剂新增")
    @PostMapping(value = "/schoolXwtj0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolXwtjVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSchoolXwtjVO vo) {
        return AppResponse.successData(eduSchoolXwtjIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学位调剂修改",description = "学位调剂修改")
    @PostMapping(value = "/schoolXwtj0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolXwtjVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSchoolXwtjVO vo) {
        return AppResponse.successData(eduSchoolXwtjIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学位调剂删除",description = "学位调剂删除")
    @PostMapping(value = "/schoolXwtj0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSchoolXwtjKeyVO vo) {
        eduSchoolXwtjIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
